<template>
	<view class="p-3 page">
		<block v-if="activeList.length>0">
			<activeItem v-for="(item,i) in activeList" :key="i" :item="item" :index="i" @callBack="callBackComponent" />
		</block>
		<view class="da-center flex-column py-4 bg-white rounded shadow" v-else>
				<view class="font-md text-dark">您暂未参加任何活动！！！</view>
				<view class="mt-4 border border-warning rounded-6 px-3" @tap="goActive" hover-class="bg-light-secondary">去参加</view>
		</view>
		
	</view>
</template>

<script>
import activeItem from '@/components/myActive/active_item.vue';
import {myActive} from '@/api/partyBuild/index.js';
	export default {
		components: {
			activeItem
		},
		data() {
			return {
				activeList:[]
			}
		},
		onReady() {
			this.getMyActive()
		},
		methods: {
			async getMyActive(){
				const {result:res} = await myActive()
				this.activeList = res
				this.activeList.forEach((v,i)=>{
					this.$set(this.activeList[i],'flag',false)
				})
			},
			callBackComponent(params){
				if(params.function){
					this[params.function](params.data)
				}
			},
			flagChange(i){
				this.activeList[i].flag = !this.activeList[i].flag
			},
			goActive(){
				uni.switchTab({
					url:'/pages/partyBuild/partyBuild'
				})
			}
		}
	}
</script>

<style scoped>
.page{
	width: 100%;
	height: 100%;
	background-color: #F4F3F8;
}
</style>
